package org.example.service.v1;

import org.example.mapper.AppMapper;
import org.example.pojo.BattleData;
import org.example.pojo.User;
import org.example.service.AppService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class AppServiceImpl implements AppService {
    @Autowired
    private AppMapper appMapper;

    @Override
    public BattleData queryBattleData(User user) {
        return appMapper.selectBattleData(user.getId());
    }

    public Map<String, Object> queryBattle(String username) {
        Map<String, Object> ret = new HashMap<>();
        ret.put("code", 0);
        ret.put("msg", "请求成功");
        ret.put("data", appMapper.selectBattles(username));
        return ret;
    }
}
